<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/9/17
 * Time: 12:36
 */
use yii\widgets\Pjax;
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
use frontend\models\Category;
use frontend\models\Goods;
?>

<html>
<body>
<div style="height: 200px;">
    <?php
    $query = Goods::find()->where(['status' => 1]);
    $dataProvider = new ActiveDataProvider([
        'query' => $query,
        'pagination' => [
            'pageSize' => 5,
        ],
        'sort' => [
            'attributes' => ['id', 'name'],
        ],
    ]);?>
    <?php Pjax::begin();?>
    <?=ListView::widget([
        'dataProvider' => $dataProvider,
        'itemOptions' => ['class' => 'item'],
        'itemView' => '_item_view',
        'pager' => ['class' => \kop\y2sp\ScrollPager::className()]
    ]);?>
    <?php Pjax::end();?>
</div>
</body>
</html>
